Post

Replies

Boosts

Views

Activity

Reply to SwiftUI TextField clearbutton how?
struct MPTextField: View {       let title: String   @Binding var text: String   @State private var isEditing: Bool = false   private var isClear: Bool {     return self.isEditing && !self.text.isEmpty   }       init(_ title: String, text: Binding<String>) {     self.title = title     self._text = text   }       var body: some View {     ZStack(alignment: .trailing) {       TextField(self.title,            text: self.$text) { isEditing in         self.isEditing = isEditing       } onCommit: {         self.isEditing = false       }       .padding(.trailing, self.isClear ? 18 : 0)               if self.isClear {         Button {           self.text = ""         } label: {           Image(systemName: "multiply.circle.fill").foregroundColor(.secondary)         }         .buttonStyle(PlainButtonStyle())       }     }     .frame(alignment: .trailing)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to iOS 16.0 beta 7 broke Text(Date(), style: .timer) in SwiftUI widgets
I'm tired of how many years this bug lasts. .timer had a long time alignment bug in widgets and had to use "multilineTextAlignment". We hoped this could be fixed in this update, but rather added a bigger bug. Developers modifying this module don't seem to be testing on widgets. It's time for the official version to be released soon, and I'm worried that it will be released without fixing any bugs.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Multiplatform development questions
I agree with most of what szymczyk answered above. Here are a few little tips I've learned while building a multi-platform app for several months. If you used UIKit functions, you need to customize them for AppKit. (UIImage, UIApplication, UIColor) Since fullScreenCover is not supported on macOS, it is best to use sheet if possible. When using lists on macOS, it looks better to use .formStyle(.grouped). Depending on the version of macOS, if there is a problem with the list in the Form not scrolling, it must be wrapped in a ScrollView. No problem in the latest version You need to create a routine that corresponds to iOS' swipe action. You will need to modify routines related to keyboard input. (keyboardType, keyDown) If you have already created a UI for iPad landscape mode, I think you will be able to easily create an app for macOS. Even if the UI is created with the same code, testing must be done separately. In particular, there were many small bugs in NavigationSplitView on the iPad, and Apple has neglected them for a long time.
Sep ’23
Reply to SwiftUI TextField clearbutton how?
struct MPTextField: View {       let title: String   @Binding var text: String   @State private var isEditing: Bool = false   private var isClear: Bool {     return self.isEditing && !self.text.isEmpty   }       init(_ title: String, text: Binding<String>) {     self.title = title     self._text = text   }       var body: some View {     ZStack(alignment: .trailing) {       TextField(self.title,            text: self.$text) { isEditing in         self.isEditing = isEditing       } onCommit: {         self.isEditing = false       }       .padding(.trailing, self.isClear ? 18 : 0)               if self.isClear {         Button {           self.text = ""         } label: {           Image(systemName: "multiply.circle.fill").foregroundColor(.secondary)         }         .buttonStyle(PlainButtonStyle())       }     }     .frame(alignment: .trailing)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to WatchOS Auto-Renewing Subscriptions
I am also having the same problem. XCode 13.2.1, watchOS 8.3 It works normally in iOS and macOS, but the "status" value is empty in watchOS. This issue is the same on the simulator and the device.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to iOS 16.0 beta 7 broke Text(Date(), style: .timer) in SwiftUI widgets
I'm tired of how many years this bug lasts. .timer had a long time alignment bug in widgets and had to use "multilineTextAlignment". We hoped this could be fixed in this update, but rather added a bigger bug. Developers modifying this module don't seem to be testing on widgets. It's time for the official version to be released soon, and I'm worried that it will be released without fixing any bugs.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to NavigationSplitView crashes in Xcode, iOS Beta 7
I too have the same problem. If I change the existing ObservableObject class to @Observable I get the same error when selecting an item from the sidebar. After seeing this error it seems @Observable is still unstable. And this problem occurs on iPad and works fine on macOS.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to @Observable crashes in Xcode, iOS Beta 7 on iPad
The problem was not resolved in XCode 15.0 beta 8. @Observable is a very nice macro. However, errors occur even in such simple code, so using @Observable is a very dangerous choice.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to ColorPicker has a bug in XCode 15 beta 8.
In my case, I didn't have this problem until XCode 15 beta 7.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to How to know the app was launched from an AppIntent in a widget?
I think the only way is to share information with the app through App Group or URL parameters and process the desired task in the app. A long time ago, there were ways to get information about running processes in iOS, but they have all been abandoned.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to Multiplatform development questions
I agree with most of what szymczyk answered above. Here are a few little tips I've learned while building a multi-platform app for several months. If you used UIKit functions, you need to customize them for AppKit. (UIImage, UIApplication, UIColor) Since fullScreenCover is not supported on macOS, it is best to use sheet if possible. When using lists on macOS, it looks better to use .formStyle(.grouped). Depending on the version of macOS, if there is a problem with the list in the Form not scrolling, it must be wrapped in a ScrollView. No problem in the latest version You need to create a routine that corresponds to iOS' swipe action. You will need to modify routines related to keyboard input. (keyboardType, keyDown) If you have already created a UI for iPad landscape mode, I think you will be able to easily create an app for macOS. Even if the UI is created with the same code, testing must be done separately. In particular, there were many small bugs in NavigationSplitView on the iPad, and Apple has neglected them for a long time.
Replies
Boosts
Views
Activity
Sep ’23